/*
 * gradientescolor.fx
 *
 * Created on 23-dic-2009, 16:11:32
 */

package ProgramSamples.Graphics;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.shape.*;
import javafx.scene.paint.Color;
import javafx.scene.paint.Stop;
import javafx.scene.paint.RadialGradient;
import javafx.scene.paint.LinearGradient;
import javafx.scene.paint.CycleMethod;
import javafx.scene.Group;


def stroke = Color.DARKSLATEGRAY;
def fill = Color.CADETBLUE;
def alterfill = Color.GOLD;
def delta = 70;

Stage {
    title: "Fill Styles"
    scene: Scene {
            fill: Color.LINEN;
            width: 250
            height: 400
            content: [
                Group{
                    translateY: 10
                    content:[
                        Rectangle {
                            x: 20
                            y: 60
                            width: 60
                            height: 50
                            arcWidth: 20
                            arcHeight: 20
                            stroke: stroke
                            fill: fill
                        },
                        Rectangle {
                            x: 20 + delta
                            y: 60
                            width: 60
                            height: 50
                            stroke: stroke
                            fill: LinearGradient {
                                startX: 0.0
                                startY: 0.0
                                endX: 1.0
                                endY: 0.0
                                proportional: true
                                stops: [
                                    Stop {offset: 0.0 color: fill },
                                    Stop {offset: 1.0 color: alterfill}
                                ]
                            }
                        },
                        Rectangle {
                            x: 20 + 2 * delta
                            y: 60
                            width: 60
                            height: 50
                            stroke: stroke
                            fill: LinearGradient {
                                startX: 0.0
                                startY: 0.0
                                endX: 220.0
                                endY: 0.0
                                proportional: false
                                stops: [
                                    Stop {offset: 0.0 color: fill },
                                    Stop {offset: 1.0 color: alterfill}
                                ]
                            }
                        }
                    ]
                },//Group
                Group {
                    content:[
                        Rectangle {
                            x: 20
                            y: 160
                            width: 60
                            height: 50
                            arcWidth: 20
                            arcHeight: 20
                            stroke: stroke
                            fill: RadialGradient {
                                centerX: 0.25,
                                centerY: 0.25,
                                radius: 0.5,
                                proportional: true
                                stops: [
                                    Stop {offset: 0.0 color: Color.WHITE},
                                    Stop {offset: 0.5 color: Color.YELLOW},
                                    Stop {offset: 1.0 color: Color.GOLD}
                                ]
                            }
                        },
                        Rectangle {
                            x: 20 + delta
                            y: 160
                            width: 60
                            height: 50
                            arcWidth: 20
                            arcHeight: 20
                            stroke: stroke
                            fill: RadialGradient {
                                centerX: 30 + delta,
                                centerY: 170,
                                radius: 30,
                                proportional: false
                                cycleMethod: CycleMethod.REFLECT
                                stops: [
                                    Stop {offset: 0.0 color: Color.WHITE},
                                    Stop {offset: 0.5 color: Color.YELLOW},
                                    Stop {offset: 1.0 color: Color.GOLD}
                                ]
                            }
                        },
                        Rectangle {
                            x: 20 + 2 * delta
                            y: 160
                            width: 60
                            height: 50
                            arcWidth: 20
                            arcHeight: 20
                            stroke: stroke
                            fill: RadialGradient {
                                centerX: 30 + 2 * delta,
                                centerY: 170,
                                radius: 30,
                                proportional: false
                                cycleMethod: CycleMethod.REPEAT
                                stops: [
                                    Stop {offset: 0.0 color: Color.WHITE},
                                    Stop {offset: 0.5 color: Color.YELLOW},
                                    Stop {offset: 1.0 color: Color.GOLD}
                                ]
                            }
                        }//Rectangle
                    ]
                }//Group
            ] //content

        }//Scene
}//Stage